(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Biodiversity Heritage Library | Children's Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Programming"

Arduino + 4 pin 5mm Full-Color LED 



.1 



Make Projects 



build, hack, tweak, share, discover,^ 



Arduino + 4 pin 5mm Full-Color 



LED 



Written By: Danny Pena 



TOOLS: 



Computer running Windows. OSX or 
Linux (1) 



PARTS: 



Transistor. NPN (3) 
Resistor (3) 

5mm Full-Color LED (1) 
Jumper Wire Pack (1) 
Arduino (1) 
Breadboard (1) 



© Make Projects 



www.makeprojects.com 



Page 1 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 1 — Schematic 



> 

go 

33 CZ 



-J 



- SCL 

- SDA 

AREF 
GND 
D13 
D12 

011 

D!0 

D9 

Da 

D7 
D6 

D5 
D4 
D3 
D2 

D1 

no 




T2 
2N3904 

R2 




1k ohm 



T3 
2N390- 

R1 

1k ohm 




LED1 
Green 



M- 



LED2 
Blue 



-K3- 

J LED3 
Red 



• This circuit uses an Arduino 
UNO but it still works on an 
Arduino MEGA 2560. 

• In this project we only use 
one 5mm LED, but since the 
LED has four pins, I used three 
LED symbols in place of the four- 
pin LED. The three cathodes of the 
LEDs in the schematic are the 
three cathodes on the Full-Color 
5mm LED. The three anodes of the 
LEDs are the one anode on the 
Full-Color 5mm LED. 



© Make Projects 



www.makeprojects.com 



Page 2 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 2 




• Remember, the longest pin of the LED is the anode, the other three short pins are 
the cathodes (RGB) 



• Also, while the flat side of the transistor is facing you, the left pin is the collector, 
the middle is the base, and the right pin is the emitter. 

• The photo notes the 2N2222 transistor. For the 2N3904 and 2N4401, the Collector 
and Emitter are switched. 






Step 3 — Circuit Assembly 



- 


............................ 

........... .................. 

.............................. 

:v::::::::::k:::::v:.v:::. 


.■■■•■■■*••»••■•■■•**■••• 



• Connect the LED to the breadboard. 

• Connect the anode of the LED to the other half of the breadboard. 

• Connect the cathode (frist pin) to the other side of the breadboard. 



© Make Projects 



www.makeprojects.com 



Page 3 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 4 — LED to Transistor 




• Connect the collector of one transistor to the first cathode of the LED. 

• Connect the other transistors as shown in the image. Connect the collector of the second 
transistor to the second cathode of the LED. 

• Connect the collector of the third transistor to the third cathode of the LED. 

• I'm using the 2N2222 transistor, so in my case the transistor faces my direction. If 
the 2N3904 or 2N4401 transistor are used, the transistor will face the opposite 
direction. 



A 



Step 5 — Transistor to Resistor 



...... .... 


m m 

.. ... ..,.<.-'•*"--- 

■-- 


. . - - 










• Connect one resistor to the base of the third transistor. 

• Connect the second resistor to the base of the second transistor. 

• Connect the third resistor to the base of the first transistor. 



© Make Projects 



www.makeprojects.com 



Page 4 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 6 — Transistor to Ground 




• Connect the emitter of all three 
transistors to ground. 



Step 7 — Resistor to Arduino 




*J m 

















• Connect the resistor from the third transistor to pin 9 on the Arduino. 

• Connect the resistor from the second transistor to pin 10 on the Arduino. 

• Connect the resistor from the first transistor to pin 1 1 on the Arduino. 



© Make Projects 



www.makeprojects.com 



Page 5 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 8 — Ground and LED anode to Arduino 




• Connect the anode of the LED to pin 12 on the Arduino. 

• Connect ground from the Arduino to the ground strip of the breadboard. 

Step 9 — Arduino Program 



in* pw ■ ll| ff a4A Uuut WD \zt IM w»>» WMIS 

-: IwM - n\ M >« *«r U> (Mw) ■ eaUia* tt -r* ua> 
UK Mafj ' 1 <'«'-•* t< 

n'.vu^hi, tunvij: 

!>**-, ■ ■■■■ -^ 
CHfli 
:■-,■■:.>■ £tanL r 0.-WJI); 
> 

// VSVf «M"e*W HTI4I uhat »WII*lt 

mtit <1*Mal.*-aiieoL*Q ** #>| 

ft tf* *!■:■* 0w> li «■* mwt 14 V* WTi.H HfitUr 

/■ *t ivtUW f# input 'to! IHfl bKOiU LW OuWul « V\ \tVJ- 

cmrart*r Dn an arnjlna. i» a <3KIBal dOLa L»j«i. S> IT [ LrpM. |. tlw 

act* is «. r™ wwt ;' »r* 1t *J, Wwtrw* i«*utn>j i. "tin* li 

* -« ■ ■ . H CM notlc-i* 6j* £M(«Wff 3Kd lie*. V 
vol . ■riial.rtalQ. T: 

dtfiiealVnli^-, HlOiji 




■ lUlaM* cacno* :' it* - f : 

rt '.tr, «r tv itij> • amtmm KMin 

Oigltoin-.t^lpaj, ittr>; 

ff t*m rfr U» : ar«r.; E (««• «r Ma a> 

oi;ito. it ;>:*<*»*, LOrfi 

<H«ltahfritiO*B, »>4a 

!:' 
9HtM.#a»aU*l 0# fa 

■ (!•*. . I.; 
alBitgHrt-itifaai, LWJ; 

a.piUift- ^(taK. WIM>; 
tans] 

" -<"tl« ">i 

A*llsirr.'.'<<lpS, 

*aitanfrieufHd, w*ji 
aisiiairriea^kaal, wm}i 

brwaVl 

hrlal.pr.-^;'<-mBHi->{ 

'■J ir. (rnfl'f V6BVCM mt (*••■> *«■*•*■ Mil cr«U Mil 

< o'oii^ii.iiri**, iftji 

Miiuin'itiniBli ml] 




Si 
hflil.ieinjiftC' *0^->l 

*i«it---^ -■■■■fit*. h|(h)i 

■WWIKriVO**!. M|tH)[ 
MAI 
aawfl 

, : .■^■{■[fcuWJl 

■lilWlPfrirr^ltati h|Ch}l 
fllCiH*l>t irc{ltat| "|i>ijl 
ili}H+l»ti>{lta*, LWJl 

' Af (in nl 1 CMIlMH VI 1 1 £■*«• CI *HI* CUpl* «>IM 
?! 

iwiai^nMurwa*!! 

#l*H*Ht.r,(l**!l, HlliH^l 
fl W ir*|lfcl^{l*# t H|I>1)L 

■iBicamnE^ltal, IWQf 

aNAE 
.V U\U HA9 Iwn: Ur UD *»l 
t! 

MlblMXIi^lr<-fff-)t 
9HSH>,'l*'ri r .i(l**|. LW)[ 
CigrtQitt-i'rfltoti L*i"jt 
■JiflililVt-i^flfra), LWJi 
bfKfiL 

■Mnrilll 



• Connect your Arduino to your computer (running Windows, OSX, Linux). 

• Open the Arduino program and upload the Arduino code within the following images. 



© Make Projects 



www.makeprojects.com 



Page 6 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 10 — Arduino Serial Monitor Testing 



800 



RED 
GREEN 

BLUE 

PURPLE 

AQUA 

ORANGE 

MUTE 

OFF 



SAutoscroll 



multiLED I Arduino 1.0.1 




I // pin variables 
d& J tnt pwr - 12; // pin 12 is the t 
" irrt ledR - 11; // pin 11 is for the (red) R cathode of the LEO 
r/\ A "' le* - 18; // pin 19 is for the (blue) B cathode of 

/dev/tty.usbmademfdl21 *^^^^^^^^^^m 



No line ending T) 9600 baud ■ i ) 



r^ 



j - ► 



: 



• After uploading the code, open the 
serial monitor and input a character 
from 1 - 8. 

• 1 = RED, 2 = GREEN, 3 = BLUE 

• The LED only has three pins for 
RGB (Red, Green, Blue), but 
turning on more then one pin 
creates diverse colors. 

• 4 = PURPLE, 5 = AQUA, 6 = 
ORANGE, 7 = BRIGHT 
WHITISH PURPLE 

• 8 = OFF 



Step 11 — RGB colors 






• Normal RGB light settings. 



© Make Projects 



www.makeprojects.com 



Page 7 of 8 



Arduino + 4 pin 5mm Full-Color LED 



Step 12 — RB, GB, and RG colors 



:::l:ft' h »»1 










r ?*^ ^ I 




• 1 









• Other RGB settings. RB, GB, or RG. 



Step 13 — LED all on or off 




• All RGB cathodes on or off. 



This document was last generated on 2012-10-31 04:40:25 AM. 



© Make Projects 



www.makeprojects.com 



Page 8 of 8